package com.anne.fish.model;

import com.anne.fish.model.BaseObject;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableComponent;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import javax.xml.bind.annotation.XmlRootElement;

import java.io.Serializable;

@Entity
@Table(name="area_category",catalog="fish")
@Searchable
@XmlRootElement
public class AreaCategory extends BaseObject implements Serializable {
    private Long id;
    private Long catId;
    private Long catFatherId;
    private Long cityId;
    private Long provinceId;

    @Id @GeneratedValue(strategy=IDENTITY) @SearchableId    
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="cat_id", nullable=false)
    @SearchableProperty
    public Long getCatId() {
        return this.catId;
    }
    
    public void setCatId(Long catId) {
        this.catId = catId;
    }
    
    @Column(name="cat_father_id", nullable=false)
    @SearchableProperty
    public Long getCatFatherId() {
        return this.catFatherId;
    }
    
    public void setCatFatherId(Long catFatherId) {
        this.catFatherId = catFatherId;
    }
    
    @Column(name="city_id", nullable=false)
    @SearchableProperty
    public Long getCityId() {
        return this.cityId;
    }
    
    public void setCityId(Long cityId) {
        this.cityId = cityId;
    }
    
    @Column(name="province_id", nullable=false)
    @SearchableProperty
    public Long getProvinceId() {
        return this.provinceId;
    }
    
    public void setProvinceId(Long provinceId) {
        this.provinceId = provinceId;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AreaCategory pojo = (AreaCategory) o;

        if (catId != null ? !catId.equals(pojo.catId) : pojo.catId != null) return false;
        if (catFatherId != null ? !catFatherId.equals(pojo.catFatherId) : pojo.catFatherId != null) return false;
        if (cityId != null ? !cityId.equals(pojo.cityId) : pojo.cityId != null) return false;
        if (provinceId != null ? !provinceId.equals(pojo.provinceId) : pojo.provinceId != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (catId != null ? catId.hashCode() : 0);
        result = 31 * result + (catFatherId != null ? catFatherId.hashCode() : 0);
        result = 31 * result + (cityId != null ? cityId.hashCode() : 0);
        result = 31 * result + (provinceId != null ? provinceId.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("id").append("='").append(getId()).append("', ");
        sb.append("catId").append("='").append(getCatId()).append("', ");
        sb.append("catFatherId").append("='").append(getCatFatherId()).append("', ");
        sb.append("cityId").append("='").append(getCityId()).append("', ");
        sb.append("provinceId").append("='").append(getProvinceId()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
